<?php


namespace app\management\model;


use think\Model;

class Copy extends Model
{

    protected $pk = 'id';
    protected $table = 'copy';

    public function getUrlAttr($value)
    {
        return urldecode($value);
    }

    public function searchDomainAttr($query, $value, $data)
    {

        return $value?$query->where('domain','in', $value):'';
    }

    public function searchCreateTimeAttr($query, $value, $data)
    {
        $times = [];
        if ($value){
            $times = cut_time($value);
        }
       return $value?$query->whereBetweenTime('create_time', $times['bTime'], $times['eTime']):'';
    }

     // 获取器转换时间
     public function getTimeAttr($time){
        return $time = gmdate('H:i:s', $time);
    }

}
